﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;


using System.Drawing;
using System.Drawing.Design;

using DotSpatial.Controls;

using DotSpatial.Data;
using DotSpatial.Symbology.Forms;
using DotSpatial.Symbology;

namespace HaGisPack
{
    public class LineSymbolEditor : UITypeEditor
    {

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService DialogProvider;
            DialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (DialogProvider != null)
            {
                DetailedLineSymbolDialog MyLineSblDlg = new DetailedLineSymbolDialog((LineSymbolizer)value);

                if (DialogProvider.ShowDialog(MyLineSblDlg) == DialogResult.OK)
                {
                    return MyLineSblDlg.Symbolizer;
                }
                else
                    return value;

            }
            else
                return value;


            //return base.EditValue(context, provider, value);
        }



        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {

            return UITypeEditorEditStyle.Modal; //省略号
            //return base.GetEditStyle(context);
        }

    }

}
